package thread.base;

/**
 * Created by mHandler on 2018/5/27 0027.
 * Description:
 */
public class Thread_synchronized01 extends Thread {

    private int count = 10 ;

    @Override
    synchronized public void run() {
        super.run();
        count--;
        System.out.println("线程"+this.currentThread().getName()+"执行：count="+count);
    }

    public static void main(String[] args) {
        Thread_synchronized01 thr01 = new Thread_synchronized01();
        Thread thread01 = new Thread(thr01,"A");
        Thread thread02 = new Thread(thr01,"B");
        Thread thread03 = new Thread(thr01,"C");
        Thread thread04 = new Thread(thr01,"D");
        Thread thread05 = new Thread(thr01,"E");
        thread01.start();
        thread02.start();
        thread03.start();
        thread04.start();
        thread05.start();
    }
}
